
<script type="text/javascript" charset="utf-8">

		var hardwaretype_id;
		var hardware_manufacturer;
		$(function(){
			
			//document.getElementById("tr_hardware_port_num").style.visibility="hidden";
			
			hardwaretype_id = $('#hardwaretype_id').combobox({
				url:'/devicespost/hardwaretypeinfo',
				valueField:'id',
				textField:'hardwaretype_name',
				editable:false,
				panelHeight:'auto',
				required:true,
				onSelect:function(record){  
				   $.ajax({            
						  type:"POST",   //post提交方式默认是get
						  url:"/devicespost/hardwaretype_isport", 
						  dataType:"json",
						  data:{hardwaretype_id:record.id},        
						  error:function(request) {      // 设置表单提交出错                 
							  alert("请求出错");  //登录错误提示信息
						  },
						  success:function(data) {
							  //网络设备就显示tr
							  if(data.isport == 1){
								  //document.getElementById("tr_hardware_port_num").style.display="inline";
								  $("#tr_hardware_port_num").show();
								  $('#hardware_port_num').numberbox({
										required: true,
										//min:1,
										max:128
									});
							  }else{
								  //document.getElementById("tr_hardware_port_num").style.display="none";
								  $("#tr_hardware_port_num").hide();
								  $('#hardware_port_num').numberbox({
										required: false,
									});
								  }
						  }         
					}); 
				}
			});
			
			hardware_manufacturer = $('#hardware_manufacturer').combobox({
				url:'/devicespost/hardwaremanufacturerinfo',
				valueField:'id',
				textField:'hardwaremanufacturer_name',
				editable:false,
				panelHeight:'auto',
				required:true
			});
			
		});

</script>

<div style="padding: 5px;">
	<form method="post">
		<table class="tableForm">
            <tr>
				<th style="width: 80px;">品牌</th>
				<td><input style="line-height:26px;border:1px solid #ccc;width:130px" class="easyui-combobox" 
				id="hardware_manufacturer" name="hardware_manufacturer" />
				</td>
			</tr>
            <tr>
				<th style="width: 80px;">名称</th>
				<td><input name="hardware_name" class="easyui-validatebox" data-options="required:'true'" style="width: 200px;" />
				</td>
			</tr>
			<tr>
                  <th style="width:80px;">类型</th>
                  <td>
                  <input style="line-height:26px;border:1px solid #ccc;width:130px" class="easyui-combobox" 
                        name="hardwaretype_id" id="hardwaretype_id" />
                  </td>
			</tr>
            <tr id="tr_hardware_port_num" style='display: none'>
				<th style="width: 80px;">端口数量</th>
				<td><input id="hardware_port_num" name="hardware_port_num" class="easyui-numberbox" data-options="max:128" style="width: 200px;" />
				</td>
			</tr>
            <tr>
				<th style="width: 80px;">备注</th>
				<td colspan="3"><textarea name="comment" style="height: 50px;width: 97%;"></textarea>
				</td>
			</tr>          
		</table>
	</form>
</div>